package com.example.leetdemo.finash;

public class Solution27 {

    public int removeElement(int[] nums, int val) {
        int p = 0, k = nums.length - 1;
        while (p <= k) {
            if (nums[p] == val) {
                nums[p] = nums[k];
                nums[k] = 0;
                k--;
            } else {
                p++;
            }
        }
        return k + 1;
    }

    public static void main(String[] args) {
        Solution27 solution27 = new Solution27();
        int a = solution27.removeElement(new int[] {0,1,2,2,3,0,4,2}, 2);
        int b = solution27.removeElement(new int[] {2}, 3);

        String date = "2024-07-09 16:15:39";
        System.err.println(date.substring(0, 7));
        System.err.println(date.substring(0, 4));
        System.err.println(date.substring(5, 7));
    }

}
